package com.my.app.tools;

import com.my.app.tools.pojo.AppConstants;
import com.my.app.tools.ui.AppUiMain;
import com.my.app.tools.ui.awt.SplashScreenWindow;
import com.my.app.tools.util.LogUtil;
import org.apache.commons.lang3.RandomUtils;

import java.awt.*;

/**
 * app界面入口
 *
 * @author guochaohui
 * @return
 * @date 2020-03-14 16:45
 */
public class MyToolsAppMain {

    /**
     * 程序启动入口，第一个传参取测试音频地址
     *
     * @param args
     * @return
     * @author guochaohui
     * @date 2020-03-27 13:06
     */
    public static void main(String[] args) {
        if (args != null && args.length > 0) {
            AppConstants.MY_TOOLS_APP_CONFIG_XML_FILE_NAME = args[0];
        }
        SplashScreenWindow splashScreenWindow = new SplashScreenWindow();
        EventQueue.invokeLater(() -> {
            AppUiMain.initAppUi();
            try {
                Thread.sleep(RandomUtils.nextInt(1000, 3000));
            } catch (InterruptedException e) {
                e.printStackTrace();
                LogUtil.error(e.getMessage());
            }
            splashScreenWindow.dispose();
        });
    }

}
